#include<bits/stdc++.h>
#define all(a) a.begin(), a.end()
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using pii = std::pair<int, int>;
using vii = std::vector<pii>;
using vi = std::vector<int>;

//std::mt19937 rng {std::chrono::steady_clock::now().time_since_epoch().count()};

int main() {
	
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);

	int a, b;
	std::cin >> a >> b;
	if(a > b) {
		std::swap(a, b);
	}
	int ans = 0;
	for(int i = -1000; i <= 1000; i++) {
		if(a - i == b - a || i - a == b - i || a - b == i - b) {
			ans++;
		}
	}
	std::cout << ans;

	return 0;
}